﻿<%@ Page Title="Danh sách người dùng" Language="C#" MasterPageFile="~/App_MasterPages/Aquarius.Master" AutoEventWireup="true" CodeBehind="SysUserPage.aspx.cs" Inherits="AlertSystem.Web.SysUserPage" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ScriptContent" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            RegisterDialog();
        });
    </script>
</asp:Content>

<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
    <div class="row-fluid">
        <div class="span12">
            <div class="head">
                <div class="isw-grid">
                </div>
                <h1>Điều kiện tìm kiếm</h1>
                <div class="clear"></div>
            </div>
            <div class="block-fluid" style="padding: 10px 0px 5px 10px">
                <table>
                    <tbody>
                        <tr>
                            <td style="width:100px; text-align:center">Tên</td>
                            <td><asp:TextBox ID="txtSearchName" runat="server" /></td>
                            <td style="width:100px; text-align:center">Nhóm</td>
                            <td><asp:DropDownList ID="ddlSearchGroup" runat="server" /></td>
                            <td style="width:100px; text-align:center">Vô hiệu</td>
                            <td>
                                <asp:DropDownList ID="ddlSearchDisable" runat="server">
                                    <asp:ListItem Value="" Text="" />
                                    <asp:ListItem Value="true" Text="TRUE" />
                                    <asp:ListItem Value="false" Text="FALSE" />
                                </asp:DropDownList>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div style="text-align: center">
                    <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" CssClass="btn" OnClick="btnSearch_Click" />
                </div>
            </div>
        </div>
    </div>
    <div class="head">
        <div class="isw-grid"></div>
        <h1>Người dùng</h1>
        <ul class="buttons">
            <li>
                <asp:LinkButton CssClass="isw-plus" ID="lbtnAddNew" runat="server" OnClick="lbtnAddNew_Click"></asp:LinkButton>
            </li>
        </ul>
        <div class="clear"></div>
    </div>
    <div class="block-fluid table-sorting">
        <asp:GridView ID="grvSysUser" class="dataTables_wrapper table2 dataTable" runat="server"
            AutoGenerateColumns="false" OnRowCommand="grvSysUser_RowCommand" ShowHeaderWhenEmpty="true">
            <Columns>
                <asp:BoundField HeaderText="Tên đăng nhập" DataField="UserName" ItemStyle-CssClass="Code"/>
                <asp:TemplateField HeaderText="Nhóm người dùng">
                    <ItemTemplate>
                        <%#SysUser.GetGroupName(Eval("UserID"))%>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:CheckBoxField HeaderText="Vô hiệu" DataField="Disabled" ItemStyle-CssClass="width1" ItemStyle-HorizontalAlign="Center"/>
                <asp:TemplateField HeaderText="Chức năng" ItemStyle-Width="175px" ItemStyle-HorizontalAlign="Center">
                    <ItemTemplate>
                        <asp:LinkButton ID="lbtnEdit" Text="Sửa" runat="server"
                            CommandName="Editing" CommandArgument='<%#Eval("UserID")%>' />
                        &nbsp; &nbsp;
                        <asp:LinkButton ID="lbtnDelete" Text="Xóa" runat="server"
                            CommandName="Deleting" CommandArgument='<%#Eval("UserID")%>' OnClientClick="return confirm('Bạn có chắc chắn muốn xóa không?');" />
                        &nbsp; &nbsp;
                        <asp:LinkButton ID="lbtnResetPassword" Text="Đổi mật khẩu" runat="server"
                            CommandName="ResetPassword" CommandArgument='<%#Eval("UserID")%>' />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>

    <div class="dialog" id="dialog-form" style="display: none; width: 600px; height: 600px;" title="Người dùng">
        <asp:panel ID="dialogPanel" runat="server" CssClass="block">
            <asp:HiddenField ID="hdfObjectId" runat="server" />
            <table width ="100%">
                <tr>
                    <td>Tên đăng nhập &nbsp;</td>
                    <td><asp:TextBox ID="txtUserName" runat="server" Enabled="false"/></td>
                </tr>
                <tr>
                    <td>Họ và tên &nbsp;</td>
                    <td><asp:TextBox ID="txtFullName" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Email &nbsp;</td>
                    <td><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Số điện thoại &nbsp;</td>
                    <td><asp:TextBox ID="txtPhone" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Địa chỉ &nbsp;</td>
                    <td><asp:TextBox ID="txtAddress" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Đại lý</td>
                    <td><asp:DropDownList ID="ddlAgency" runat="server" /></td>
                </tr>
                <tr>
                    <td>Nhóm người dùng</td>
                    <td><asp:ListBox ID="ddlGroup" runat="server" SelectionMode="Multiple" Rows="10"/></td>
                </tr>
                <tr>
                    <td>Ngưng SD &nbsp;</td>
                    <td><asp:CheckBox ID="chkDisable" runat="server" /></td>
                </tr>
            </table>
            <div style="text-align:center; color:Red">
                <asp:Label ID="lbEditMsg" runat="server" />
            </div>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <asp:Button ID="btnSave" CssClass="btn" runat="server" Text="Lưu" OnClick="btnSave_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog-form').dialog('close'); return false;" />
            </div>
        </asp:panel>
    </div>
    <div class="dialog" id="dialog_addnew" style="display: none; width: 600px; height: 600px;" title="Người dùng">
        <asp:panel ID="pn_dialog_addnew" runat="server" CssClass="block">
            <table width ="100%">
                <tr>
                    <td>Tên đăng nhập &nbsp;</td>
                    <td><asp:TextBox ID="txtNewUserName" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Mật khẩu&nbsp;</td>
                    <td><asp:TextBox ID="txtNewPassWord" TextMode="Password" runat="server" /></td>
                </tr>
                <tr>
                    <td>Nhập lại mật khẩu</td>
                    <td><asp:TextBox ID="txtReNewPassWord" TextMode="Password" runat="server" /></td>
                </tr>
                <tr>
                    <td>Họ và tên &nbsp;</td>
                    <td><asp:TextBox ID="txtNewFullName" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Email &nbsp;</td>
                    <td><asp:TextBox ID="txtNewEmail" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Số điện thoại &nbsp;</td>
                    <td><asp:TextBox ID="txtNewPhone" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Địa chỉ &nbsp;</td>
                    <td><asp:TextBox ID="txtNewAddress" runat="server"></asp:TextBox></td>
                </tr>
                <tr>
                    <td>Đại lý</td>
                    <td><asp:DropDownList ID="ddlNewAgency" runat="server" /></td>
                </tr>
                <tr>
                    <td>Nhóm người dùng</td>
                    <td><asp:ListBox ID="ddlNewGroup" runat="server" SelectionMode="Multiple" Rows="10"/></td>
                </tr>
            </table>
            <div style="text-align:center; color:Red">
                <asp:Label ID="lbAddNewMsg" runat="server" />
            </div>
            <div class="dr"><span></span></div>
            <div style="text-align: right">
                <asp:Button ID="btnAddNew" CssClass="btn" runat="server" Text="Lưu" OnClick="btnAddNew_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialog_addnew').dialog('close'); return false;" />
            </div>
        </asp:panel>
    </div>
    <div class="dialog" id="dialogResetPassword" style="display: none; width: 600px; height: 600px;" title="Đổi mật khẩu">
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <div class="block">
            <table width ="100%">
                <tr>
                    <td>Người dùng</td>
                    <td><asp:TextBox ID="txtChangePasswordUser" runat="server" Enabled="false" /></td>
                </tr>
                <tr>
                    <td>Mật khẩu mới</td>
                    <td><asp:TextBox ID="txtNewRsPassword" runat="server" TextMode="Password"/></td>
                </tr>
                <tr>
                    <td>Nhập lại mật khẩu&nbsp;</td>
                    <td><asp:TextBox ID="txtReNewRsPassword" TextMode="Password" runat="server" /></td>
                </tr>                    
            </table>
            <div class="dr"><span></span></div>
            <div style="text-align:center; color:Red">
                <asp:Label ID="lbMsgResetPassword" runat="server" />
            </div>
            <div style="text-align: right">
                <asp:Button ID="btnSaveResetPassword" CssClass="btn" runat="server" Text="Lưu" OnClick="btnSaveResetPassword_Click" />
                <input type="button" class="btn" value="Đóng" onclick="$('#dialogResetPassword').dialog('close'); return false;" />
            </div>
        </div>
    </div>
</asp:Content>